﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;


namespace AMing.Api.Client
{
    internal class Config
    {
        static Config()
        {
            LoadConfig("api_keyval_list", ref list);
            LoadConfig("api_keyval_get", ref get);
            LoadConfig("api_keyval_value", ref value);
            LoadConfig("api_keyval_add", ref add);
            LoadConfig("api_keyval_update", ref update);
            LoadConfig("api_keyval_delete", ref delete);
        }

        private static string list = "http://api.aming.co/keyvalue";
        internal static string List
        {
            get { return list; }
        }

        private static string get = "http://api.aming.co/keyvalue/get";
        internal static string Get
        {
            get { return get; }
        }
        private static string value = "http://api.aming.co/keyvalue/value";
        internal static string Value
        {
            get { return value; }
        }
        private static string exist = "http://api.aming.co/keyvalue/exist";
        internal static string Exist
        {
            get { return exist; }
        }
        private static string add = "http://api.aming.co/keyvalue/add";
        internal static string Add
        {
            get { return add; }
        }
        private static string update = "http://api.aming.co/keyvalue/update";
        internal static string Update
        {
            get { return update; }
        }
        private static string addorupdate = "http://api.aming.co/keyvalue/addorupdate";
        internal static string AddOrUpdate
        {
            get { return addorupdate; }
        }
        private static string delete = "http://api.aming.co/keyvalue/delete";
        internal static string Delete
        {
            get { return delete; }
        }

        static void LoadConfig(string key, ref string val)
        {
            string data = ConfigurationManager.AppSettings[key];
            if (!string.IsNullOrWhiteSpace(data))
            {
                val = data;
            }
        }
    }
}
